|
|
|
|
|
|
|
As you can see in Figure 3.1, two more classes appear in the class model: CreditHistoryInfo and CheckAccountHistoryInfo. Each rectangle is an icon representing a class. The line between the Customer class and the BankAccounts class indicates an association between the two classes. The black diamond means that the Customer class has an instance of the BankAccounts class. The same relationship exists between the BankAccounts class and the Account class, with the single BankAccounts class (1..1, meaning a minimum of one to a maximum of 1) having one or more instances (1..*, or one to many) of the Account class. The broken lines with arrows, between the BankAccounts class and the two new classes, indicate that the BankAccounts class depends on (uses) the two classes. The icon to the left of the isHistoryOK property in the CheckAccountHistoryInfo class indicates this property is private. The purple icon next to the verify method in the same class means it's a public method. For the sake of simplicity, let's decide that each of these classes has a method called verify to handle customer information processing. That both classes can have a method with the same name but different implementations is an example of a form of polymorphism. |
|
|
|
|
|
|
|
|
Your modeling tools (Visual Modeler and Rational Rose/Visual Basic) enable you to show the methods for each class. Figure 3.2 shows each class with its methods and properties displayed. Note that, in most cases, you don't want to show more class members than is necessary to explain a particular scenario. Otherwise, the models become cluttered with model elements and almost unreadable. |
|
|
|
|
|
|
|
|
Figure 3.2.
Now the class diagram has more expressive classes with properties and
methods. As a rule, try not to show every member of every class for
a given scenario (or application context or situation). |
|
|
|
|
|
|
|
|
Why is avoiding the clutter of models important? Because readability is an obvious benefit of object-oriented models. Certain scenarios call for different views of your class |
|
|
|
|
|